package com.example.makerspace.dao;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.makerspace.domain.CourseDO;
import com.example.makerspace.mapper.CourseMapper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
public class CourseDAO extends BaseDAO<CourseDO>{
    @Resource
    private CourseMapper courseMapper;

    @PostConstruct
    public void init(){
        this.mapper = courseMapper;
    }

    public final static String COURSE_NAME = "course_name";

    public CourseDO selectByCourseName(String courseName){
        return courseMapper.selectOne(new QueryWrapper<CourseDO>().eq(COURSE_NAME, courseName));
    }
}
